// observer 观察者模式 监听文件流传输
var fs = require('fs')
var readStream = fs.createReadStream('./data/file1.txt')

var length = 0
readStream.on('data', function (chunk) {
  length += chunk.toString().length
})

readStream.on('end', function () {
  console.log(length)
})